<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	if (session.getAttribute("userName") == null) {
		//response.sendRedirect("http://localhost:5596/cmpe451Web/");
		response.sendRedirect("default.jsp");

	} else {
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Homepage</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />


<div class="header">
	<div class="wrapper">
		<div class="logo">
			<img src="images/banner.jpg" alt="" />
		</div>

		<div class="login user">
			<form name="dummy" action="Logout" method="post">
				<div class="form-input" style="margin-right: 0">
					<p>
							Hi,
							<%=session.getAttribute("userName")%></p>
					<input type="submit" value="Logout" />
				</div>
			</form>
		</div>


	</div>
</div>
<style type="text/css">
body {
	margin: 0;
}

p {
	color: crimson;
}
</style>
</head>


<body background="images/background.jpg">
	<form name="dummy" action="HomePages" method="get">
		<div class="content">
			<div class="wrapper">

				<div class="leftmenu">
					<ul>
						<li><a href="default.jsp">Home Page</a></li>
						<li><a href="homeMember.jsp">Profile Page</a></li>
						<li><a href="addReport.jsp">Add Report</a></li>
						<li><a href="searchPage.jsp">Search For a Report</a></li>

					</ul>
				</div>

				<div class="centercol">

					<h3>Your Reports</h3>
					<label>You can view reports generated by you and follow
						them!</label> <input class="btn-left" name="button" type="Submit"
						value="View my reports"> <br> <br> <br>
					<br>
					<br>
					<c:forEach var="report" items="${ownReports}">
						<div class="report-list">
							<div class="report-list-item">

								<table>

									<tr>

										<td class="col1" width="100">Report Name</td>
										<td width="10">:</td>
										<td class="col1" width="250"><a
											href="ViewPage?qid=${report.report_id}">${report.reportName}</a></td>
									</tr>
									<tr>
										<td class="col1">Status</td>
										<td width="10">:</td>
										<td class="col2">
										<c:if test="${report.status==0}">Detected</c:if>
										<c:if test="${report.status==1}">In Progress</c:if>
										<c:if test="${report.status==2}">Fixed</c:if>
										<c:if test="${report.status==3}">Friendly Location</c:if></td>
									</tr>
									<tr>
										<td class="col1">Description</td>
										<td width="10">:</td>
										<td class="col2">${report.description}</td>
									</tr>

								</table>
							</div>
						</div>
					</c:forEach>
				</div>

				<div class="rightcol subscribed">


					<h3>Subscribed Reports</h3>
					<label>You can follow reports that you subscribed in!</label> <input
						class="btn-left" name="button" type="Submit"
						value="View my subscriptions"> <br>
					<br>
					<br>
					<br>
					<c:forEach var="report" items="${subsReports}">
						<div class="report-list">
							<div class="report-list-item">
								<table>
									<tr>
										<td class="col1" width="100">Report Name</td>
										<td width="10">:</td>
										<td class="col1" width="250"><a
											href="ViewPage?qid=${report.report_id}">${report.reportName}</a>
										</td>
									</tr>
									<tr>
										<td class="col1">Status</td>
										<td width="10">:</td>
										<td class="col2">
										<c:if test="${report.status==0}">Detected</c:if>
										<c:if test="${report.status==1}">In Progress</c:if>
										<c:if test="${report.status==2}">Fixed</c:if>
										<c:if test="${report.status==3}">Friendly Location</c:if></td>
									</tr>
									<tr>
										<td class="col1">Description</td>
										<td width="10">:</td>
										<td class="col2 desc">${report.description}</td>
									</tr>
								</table>
							</div>
						</div>
					</c:forEach>



				</div>

				<div class="clear"></div>

			</div>
		</div>
	</form>
	<%--<center>
		<h1>Welcome Member Home Page!</h1>
		<br></br>
		<form name="dummy" action="HomePages" method="get">  
 	
    	<input name="button" type="Submit"  value="Add Report">
    	<br></br>
    	<input name="button" type="Submit"  value="Search for Violation">
    	<br></br>
    	<input name="button" type="Submit"  value="View my subscriptions">
    	<br></br>
    	<input name="button" type="Submit"  value="View my reports">
    	<br></br>
    	<input name="button" type="Submit"  value="Log Out">    
    	
    	<table>
	  	<tr>
		<c:if test="${subscriptions == true}">
		<p>Your Subscriptions:</p>
		<ul class="{list-style-type:circle;}">
			<c:forEach var="report" items="${subsReports}">
  				<li><a href="ViewPage?qid=${report.report_id}">${report.reportName}</a></li>
  			</c:forEach>
  		</ul>
  		</c:if>	
  		<c:if test="${reportFlag == true}">
		<p>Your Reports:</p>	
		<ul class="{list-style-type:circle;}">
			<c:forEach var="report" items="${ownReports}">
  				<li><a href="ViewPage?qid=${report.report_id}">${report.reportName}</a></li>
  			</c:forEach>
  		</ul>
  		</c:if>							
	   	</tr>
   		</table>
    	
    	
    	</form>
    </center>--%>
</body>
</html>
<%}%>